package com.dhcc.core.modules.msgcenter.warpper;

import java.util.Map;

import com.dhcc.core.framework.base.warpper.BaseControllerWarpper;
import com.dhcc.core.framework.util.ArrayUtil;
import com.dhcc.core.framework.util.CommonUtil;
import com.dhcc.core.modules.msgcenter.cache.MsgCache;

/**
 * 消息模块列表的包装
 * 
 * @ClassName: MsgModuleWarpper
 * @Description: TODO
 * @author: cyf
 * @date: 2018年1月2日 上午10:43:13
 */
public class MsgModuleWarpper extends BaseControllerWarpper {

    public MsgModuleWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {

        String pushTypeStr = (String) map.get("pushTypes");
        String[] pts = ArrayUtil.stringToArray(pushTypeStr, ArrayUtil.COMMA);
        if (CommonUtil.isEmpty(pts)) {
            map.put("pushTypeNames", "");
        } else {
            Map<String, String> pushTypes = MsgCache.me().getPushTypes();
            String pushTypeNames = "";
            for (int i = 0; i < pts.length; i++) {
                pushTypeNames += (i==0?"":",")+pushTypes.get(pts[i]);
            }
            map.put("pushTypeNames", pushTypeNames);
        }
    }

}
